home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / LPC / initialisation < prev    next >
Text File  |  1999-03-31  |  2KB  |  39 lines

  1. CONCEPT
  2.  
  3.         INITIALIZATION
  4.  
  5. DESCRIPTION
  6.  
  7.         There are two different flavours of initialisations, selectable
  8.         in config.h :
  9.  
  10.         i)  #undef INITIALIZATION_BY___INIT
  11.         ------------------------------------
  12.         Initialisation is done at compile time. This is fast and costs
  13.         no extra code in the program.
  14.         Allowed expressions currently include integer literals,
  15.         string literals, integer operators, string addition, bracketing,
  16.         array constructors, the empty mapping and order_alist().
  17.         When an object with initialised variables is cloned or inherited,
  18.         all initialised variables are copied from the blueprint.
  19.         A special application of this feature is to have an initialised
  20.         non-empty array or a mapping; it will be shared by all clones or
  21.         inheriting objects unless an assignment to the variable -
  22.         as opposed to an assignment to an element of the array/mapping -
  23.         is done in all clones etc.
  24.         To prevent unauthorised changes in initialised arrays/mappings,
  25.         you can declare the variables as private or use
  26.         a nomask reset/create that checks for undesired inheritance.
  27.  
  28.         ii) #define INITIALIZATION_BY___INIT
  29.         -------------------------------------
  30.         Creates a function names __INIT() from all variable
  31.         initialisations and from calls to __INIT() in all inherited
  32.         objects, and runs this function at object creation time.
  33.         Any efun can be used in the expressions for variable
  34.         initialisations, even ones with severe side effects, like
  35.         destruct() or shutdown().  The code created for __INIT() is
  36.         a little worse than a medium-skilled lpc-programmer would
  37.         generate, because it is scattered all over the program.
  38.  
  39.